#include<bits/stdc++.h>
using namespace std;
namespace my_std{
	#define ll long long
	#define bl bool
	ll my_pow(ll a,ll b,ll mod){
		ll res=1;
		if(!b) return 1;
		while(b){
			if(b&1) res=(res*a)%mod;
			a=(a*a)%mod;
			b>>=1;
		}
		return res;
	}
	ll qpow(ll a,ll b){
		ll res=1;
		if(!b) return 1;
		while(b){
			if(b&1) res*=a;
			a*=a;
			b>>=1;
		}
		return res;
	}
	#define db double
	#define pf printf
	#define pc putchar
	#define fr(i,x,y) for(register ll i=(x);i<=(y);i++)
	#define pfr(i,x,y) for(register ll i=(x);i>=(y);i--)
	#define go(u) for(ll i=head[u];i;i=e[i].nxt)
	#define enter pc('\n')
	#define space pc(' ')
	#define fir first
	#define sec second
	#define MP make_pair
	#define il inline
	#define inf 1e18
	#define random(x) rand()*rand()%(x)
	#define inv(a,mod) my_pow((a),(mod-2),(mod))
	il ll read(){
		ll sum=0,f=1;
		char ch=0;
		while(!isdigit(ch)){
			if(ch=='-') f=-1;
			ch=getchar();
		}
		while(isdigit(ch)){
			sum=sum*10+(ch^48);
			ch=getchar();
		}
		return sum*f;
	}
	il void write(ll x){
		if(x<0){
			x=-x;
			pc('-');
		}
		if(x>9) write(x/10);
		pc(x%10+'0');
	}
	il void writeln(ll x){
		write(x);
		enter;
	}
	il void writesp(ll x){
		write(x);
		space;
	}
}
using namespace my_std;
priority_queue<pair<ll,ll> > q;
ll n,m,a,b,head[150015],cnt=0,cntt,dis[150015];
bl ck[150015];
struct node{
	ll nxt,to;	
}e[600060],E[750075];
void add(ll u,ll v){
	e[++cnt].nxt=head[u];
	e[cnt].to=v;
	head[u]=cnt;
}
il void dijkstra(){
	fr(i,1,n) dis[i]=inf;
	dis[1]=0;
	q.push(MP(0,1));
	while(!q.empty()){
		pair<ll,ll> u=q.top();
		q.pop();
		if(-u.fir>dis[u.sec]) continue;
		go(u.sec) ck[e[i].to]=1;
		go(u.sec){
			ll v=e[i].to;
			if(dis[v]>(-u.fir+a)){
				dis[v]=-u.fir+a;
				q.push(MP(-dis[v],v));
			}
			ll pre=v,now=E[v].nxt;
			while(now){
				ll w=E[now].to;
				if(ck[w]) pre=now;
				else{
					if(dis[w]>(-u.fir+b)){
						dis[w]=-u.fir+b;
						q.push(MP(-dis[w],w));
					}
					E[pre].nxt=E[now].nxt;
				}
				now=E[now].nxt;
			}
		}
		go(u.sec) ck[e[i].to]=0;
	}
}
int main(){
	freopen("edge.in","r",stdin);
	freopen("edge.out","w",stdout);
	n=read();
	m=read();
	a=read();
	b=read();
	fr(i,1,m){
		ll u=read(),v=read();
		add(u,v);
		add(v,u);
	}
	cntt=n;
	fr(u,1,n){
		ll pre=u;
		go(u){
			ll v=e[i].to;
			E[pre].nxt=++cntt;
			E[cntt].to=v;
			pre=cntt;
		}
	}
	dijkstra();
	fr(i,2,n) writeln(dis[i]);
}
